import { getItem, setItem } from '@/utils/storage'
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
const TOKNE_KEY='TOUTIAO_USER'

export default new Vuex.Store({
  state: {
    user:getItem(TOKNE_KEY)
    // user:JSON.parse(window.localStorage.getItem(TOKNE_KEY)||null)
  },
  getters: {
  },
  mutations: {
    setUser(state,data) {
      state.user = data
      setItem(TOKNE_KEY,state.user)
      // window.localStorage.setItem(TOKNE_KEY,JSON.stringify(state.user))
    }
  },
  actions: {
  },
  modules: {
  }
})
